package com.example.apphandlermessage;

import android.app.Activity;
import android.os.Bundle;
import android.os.Message;
import android.widget.ProgressBar;

public class MainActivity extends Activity {
    ProgressBar barreProgres;
	MyThread myThread;
	Thread th;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        barreProgres=(ProgressBar)findViewById(R.id.progressbar);
        myThread =new MyThread();
        
    }
    public void onStart(){
      super.onStart();
      barreProgres.setProgress(0);
      th= new Thread(new MyThread());
      }
    
      
    
    public void handleMessage(Message msg) {
    	barreProgres.incrementProgressBy(5);
    	if(barreProgres.getProgress()==100){
    	   barreProgres.setProgress(0);
    	}
		
	}
}
